﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TeamBuy.AccessWebUI
{
    public partial class Deal : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["ID"] != "" && Request.QueryString["ID"] != null)
            {
                Main_DealDetail1.ShowDealByID(Convert.ToInt32(Common.PublicFunction.DESDecrypt(Request.QueryString["ID"].ToString())));
                Side_TodayDeal1.SelectCommand = "SELECT * FROM [S_Deal] WHERE IsTodayMainDeal = Yes AND format(DateStarted,\"yyyy-MM-dd\")='" + DateTime.Now.ToShortDateString() + "' AND CityID = " + ((Components.Head)(Page.Master.Master.FindControl("Head1"))).CurrentCityID;
                int currentDealStatus = Main_DealDetail1.GetCurrentDealStatus();
                if (currentDealStatus == 2 || currentDealStatus == 3)
                {
                    Main_SoldoutTip1.Visible = true;
                }
            }
            else
            {
                Response.Redirect("/Default.aspx");
            }
            Page.Title = Main_DealDetail1.GetCurrentDealTitle() + " - " + TeamBuy.AccessService.TeamBuySystemInfo.SiteName;

        }
    }
}